﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


using ClassModel;
using ClassDAL;
using ClassCommon;

namespace ClassBLL
{
    public class t_class_attachment_info_BLL
    {
        /// <summary>
        /// 插入用户附加信息
        /// </summary>
        /// <param name="attachment">附加信息</param>
        /// <returns>返回附加信息自增id</returns>
        public static int InsertAttachment(t_class_attachment_info attachment)
        {
            if (attachment == null) throw new ArgumentException("attachment 参数不能为空!");



            return t_class_attachment_info_DAL.InsertAttachment(attachment);
        }

        /// <summary>
        /// 检查当前附件是否存在
        /// </summary>
        /// <param name="attchment"></param>
        /// <returns></returns>
        private static bool CheckAttachmentIsExists(t_class_attachment_info attchment)
        {
            return false;
        }

         /// <summary>
        /// 检查当前用户附加信息是否存在
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static int CheckAttachmentExists(int userID)
        {
            return t_class_attachment_info_DAL.CheckAttachmentExists(userID);
        }


        /// <summary>
        /// 获取用户提交的附加信息列表
        /// </summary>
        /// <param name="userID">用户id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageCount">每页条数</param>
        /// <returns>返回集合</returns>
        public static IList<t_class_attachment_info> List(int userID, int pageIndex = 0, int pageCount = 10)
        {
            return t_class_attachment_info_DAL.List(userID, pageIndex, pageCount);
        }


        /// <summary>
        /// 获取用户附加信息
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public static t_class_attachment_info GetAttachmentByUserId(int userid)
        {
            return t_class_attachment_info_DAL.GetAttachmentByUserId(userid);
        }


        /// <summary>
        /// 编辑用户附加信息
        /// </summary>
        /// <param name="attachinfo"></param>
        /// <returns></returns>
        public static int UpdateAttachment(t_class_attachment_info attachinfo)
        {
            return t_class_attachment_info_DAL.UpdateAttachment(attachinfo);
        }
    }
}
